package com.onesports.intelligent.k12.polarlight.service.sys;

import com.onesports.intelligent.k12.polarlight.domain.entity.sys.Resource;
import com.onesports.intelligent.k12.polarlight.mapper.sys.ResourceMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author generator
 * @since 2021-09-30
 */
@Service
@RequiredArgsConstructor
public class ResourceService {

    private final ResourceMapper resourceMapper;

    /**
     * 添加资源
     *
     * @param resource 入参
     */
    public void add(Resource resource) {
        this.resourceMapper.insert(resource);
    }

    /**
     * 修改
     *
     * @param resource 入参
     */
    public void update(Resource resource) {
        this.resourceMapper.updateById(resource);
    }


    /**
     * 删除
     *
     * @param id resource id
     */
    public void delete(String id) {
        this.resourceMapper.deleteById(id);
    }

    /**
     * 获取所有
     */
    public List<Resource> getAllList() {
        return this.resourceMapper.selectList(null);
    }

    public List<Resource> listByAccountId(String accountId, String systemCode) {
        return resourceMapper.listByAccountId(accountId, systemCode);
    }

    public List<Resource> listBySystemCode(String systemCode) {
        return resourceMapper.listBySystemCode(systemCode);
    }
}
